/*
 * @Author       : ljkt
 * @Version      : 1.0
 * @Date         : 2021-10-05 18:00:43
 * @LastEditors: ljkt
 * @LastEditTime: 2025-07-20 12:00:17
 * @Description  :
 */

#ifndef _DEV_NTC_H_
#define _DEV_NTC_H_
// #define EN_DEV_NTC
#if defined(EN_DEV_NTC) && defined(EN_ADC)
#define GetNtcTempMax2Min(name, adc_2_temp_infor, drv_adc_name)                                                            \
    do                                                                                                                     \
    {                                                                                                                      \
        name.adc_2_temp = &adc_2_temp_infor;                                                                               \
        name.drv_adc = &gDrvAdc[drv_adc_name];                                                                             \
        name.Index = Arrary_BinSearch_Max2Min_u16(name.adc_2_temp->addr, name.drv_adc->Avg, name.adc_2_temp->tab_max_cnt); \
        name.Temp10 = Dev_Ntc_Get_Temp10Max2Min(&name);                                                                    \
        name.Temp = name.Temp10 / 10l;                                                                                     \
    } while (0)
#define GetNtcTempMin2Max(name, adc_2_temp_infor, drv_adc_name)                                                            \
    do                                                                                                                     \
    {                                                                                                                      \
        name.adc_2_temp = &adc_2_temp_infor;                                                                               \
        name.drv_adc = &gDrvAdc[drv_adc_name];                                                                             \
        name.Index = Arrary_BinSearch_Min2Max_u16(name.adc_2_temp->addr, name.drv_adc->Avg, name.adc_2_temp->tab_max_cnt); \
        name.Temp10 = Dev_Ntc_Get_Temp10Min2Max(&name);                                                                    \
        name.Temp = name.Temp10 / 10l;                                                                                     \
    } while (0)
typedef struct
{
    unsigned short *addr;
    unsigned short tab_max_cnt;
    signed short offset;
} s_adc_2_temp_t;
typedef struct
{
    unsigned char Byte;
} s_warn_t;

typedef struct
{
    s_warn_t Warn;
    signed short Temp;
    signed short Temp10;        //
    signed short Index;         //
    s_adc_2_temp_t *adc_2_temp; //
    s_drv_adc_t *drv_adc;
} s_obj_ntc_t;
typedef struct
{
    s_obj_ntc_t Water;
} s_dev_ntc_t;
extern Ram s_dev_ntc_t gDev_Ntc;

void Dev_Ntc_Init(void);
void Dev_Ntc_Scan(void);
#endif
#endif
